]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Add API to get windows and metaWindow to WindowCloneLayout
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 8 Jun 2020 12:47:43 +0000 (14:47 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Thu, 11 Jun 2020 18:49:31 +0000 (20:49 +0200)
This will allow us to remove the remaining parts of the WindowClone
looping through children in favour of simply getting an array with the
windows or metaWindows and looping through that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1298

js/ui/workspace.js

index fccb5c5608f4151304b43b94fbb79db01fcddf09..c815ebec8b4ea21cf52503a19210bcf222ab6e12 100644 (file)
@@ -159,6 +159,36 @@ var WindowCloneLayout = GObject.registerClass({
         this._layoutChanged();
     }
 
+    /**
+     * getWindows:
+     *
+     * Gets an array of all ClutterActors that were added to the layout
+     * using addWindow(), ordered by the insertion order.
+     *
+     * @returns {Array} An array including all windows
+     */
+    getWindows() {
+        return [...this._windows.keys()];
+    }
+
+    /**
+     * getMetaWindow:
+     * @param {Clutter.Actor} window: the window to get the MetaWindow for
+     *
+     * Gets the MetaWindow associated to the ClutterActor @window that was
+     * added to the layout using addWindow(). If @window is not found,
+     * null is returned.
+     *
+     * @returns {Meta.Window} The metaWindow of the window
+     */
+    getMetaWindow(window) {
+        const windowInfo = this._windows.get(window);
+        if (!windowInfo)
+            return null;
+
+        return windowInfo.metaWindow;
+    }
+
     // eslint-disable-next-line camelcase
     get bounding_box() {
         return this._boundingBox;